import java.io.*;
import java.util.List;

class Stream extends Data {

	public static void main(String[] args) {
		Stax read = new Stax();
	    List<Data> readConfig = read.readConfig("src/test.xml");
	    Data info = readConfig.get(0);
	    System.out.println(info.getPrijmeni());
	    File f = new File("");
	    System.out.println(f.getAbsolutePath());
	    File slozka=new File(f.getAbsolutePath() + "/test/"+info.getJmeno()+"."+info.getPrijmeni()+"/");
	    slozka.mkdir();
	    
	    try{
            byte[] buffer = new byte[32];
            InputStream input = new FileInputStream("src/test.xml");
            try {
                OutputStream output = new FileOutputStream(slozka.getAbsolutePath()+"/"+info.getJmeno()+"."+info.getPrijmeni()+".xml");
                try {
                    int size = input.read(buffer);
                    while (size > 0) {
                        output.write(buffer, 0, size);
                        size = input.read(buffer);
                    }
                }
                finally {
                    output.flush();
                    output.close();
                }
            }
            finally {
                input.close();
            }
        } catch(Exception e){
            System.out.println("Unable to copy files\n" + e);
        } 
	      
	        
	        
		
	    }
}